package org.moore.controller;

import javax.swing.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

// 欢迎窗口监听类
public class WelcomeWindowListener implements WindowListener {
    @Override
    public void windowOpened(WindowEvent e) {

    }

    @Override
    public void windowClosing(WindowEvent e) {
        Object[] exitOptions = { "退出", "取消" };
        int exitInput = JOptionPane.showOptionDialog(null, "您真的要退出吗？", "确认退出",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, exitOptions, exitOptions[0]);
        // 退出选项判断
        if (exitInput == 0) {
            // 关闭窗口
            System.exit(0);
        }
    }

    @Override
    public void windowClosed(WindowEvent e) {

    }

    @Override
    public void windowIconified(WindowEvent e) {

    }

    @Override
    public void windowDeiconified(WindowEvent e) {

    }

    @Override
    public void windowActivated(WindowEvent e) {

    }

    @Override
    public void windowDeactivated(WindowEvent e) {

    }
}
